#include <attackTargetMessage.h>

namespace Model {

  int AttackTargetMessage::ReceiveBroadcast(Controller::Broadcast *broadcast)
  {
    using namespace Controller;
    BroadcastType type = broadcast->GetBroadcastType();
    switch(type)
      {
      case BROADCAST_TYPE_ARP_ALL_ADDRESS:{
	std::string allAddress(broadcast->GetStringData());
	allAddress = allAddress.substr(allAddress.find("#")+1);
	allAddress = allAddress.substr(allAddress.find("#")+1);
	ip = allAddress.substr(0,allAddress.find("#"));
	allAddress = allAddress.substr(allAddress.find("#")+1);
	mac = allAddress.substr(0,allAddress.find("#"));
      }break;
      case BROADCAST_TYPE_SYN_ALL_ADDRESS:{
	std::string allAddress(broadcast->GetStringData());
	ip = allAddress.substr(0,allAddress.find("#"));
	allAddress = allAddress.substr(allAddress.find("#")+1);
	attackPort = allAddress.substr(0,allAddress.find("#"));
      }break;
      case BROADCAST_TYPE_SMURF_ALL_ADDRESS:{
        std::string allAddress(broadcast->GetStringData());
	ip = allAddress.substr(0,allAddress.find("#"));
      }break;
      default:break;
      }
    return 0;
  }
  
  int AttackTargetMessage::ReLoadConf()
  {
    return 0;
  }

  
}
